package com.example.speedwaymanager;

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

/**
 * @author lnowak
 *
 */
public class MyPageAdapterTable extends FragmentStatePagerAdapter {

	private static final int NUM_PAGES_HEAT = 2;
	private Activity _context;
	
	
	public MyPageAdapterTable(FragmentManager fm, Activity context) {
		super(fm);		
		_context = context;
	}
		
	/* (non-Javadoc)
	 * @see android.support.v4.app.FragmentPagerAdapter#getItem(int)
	 */
	@Override
	public Fragment getItem(int position) {
		Bundle args = new Bundle();
        args.putInt("object", position);
		//return new TableFragment();
        return Fragment.instantiate(_context, TableFragment.class.getName(), args);		
	}

	@Override
	public int getItemPosition(Object object) {
	    return POSITION_NONE;
	}
	
	/* (non-Javadoc)
	 * @see android.support.v4.view.PagerAdapter#getCount()
	 */
	@Override
	public int getCount() {
		return NUM_PAGES_HEAT; 		
	}
	
	 @Override
     public CharSequence getPageTitle(int position) {
         return CGameManager.getInstance().get_match().get_teams().get(position).get_name().toString();
     }

}